package com.zjw.strategy.productStrategyImpl;

import com.zjw.strategy.ProductStrategy;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.math.RoundingMode;


/**
 * 商品不打折策略类
 */
@Component
public class NoDiscount4Product implements ProductStrategy {



    @Override
    public double calPrice(String num, String price) {
        BigDecimal bigDecimalNum = new BigDecimal(num);
        BigDecimal bigDecimalPrice = new BigDecimal(price);
        return bigDecimalNum.multiply(bigDecimalPrice).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }
}
